package com.openNetty.server.timertask;

import com.openNetty.common.system.LoggerUtil;
import com.openNetty.common.utils.FileTransUtil;
import com.openNetty.server.main.Global;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;


/**
 * 定时清理文件
 *
 * @version 1.0.0
 * @Author zhenggm
 */
public class CleanFileTask implements Job {
    private static LoggerUtil logger = LoggerUtil.getLogger(CleanFileTask.class);

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.debug("定时清理文件夹任务启动");
        String unzip = Global.properties.getProperty("back.root");
        if (FileTransUtil.delAllFile(unzip)) {
            logger.debug("清理解压缩文件夹成功,任务结束");
        } else {
            logger.debug("文件夹不存在,无需清理");
        }
    }
}
